﻿<UserControl x:Class="Explorer.WPF.UI.DirectoryTabItem"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
             xmlns:local="clr-namespace:Explorer.WPF.UI"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <TextBox Text="{Binding FilePath}"/>

        <ListBox Grid.Row="1"
         ItemsSource="{Binding DirectoriesAndFiles}"
         SelectedItem="{Binding SelectedFileEntity}">

            <b:Interaction.Triggers>
                <b:EventTrigger EventName="MouseDoubleClick">
                    <b:InvokeCommandAction 
                Command="{Binding OpenCommand}"
                CommandParameter="{Binding SelectedFileEntity}"/>
                </b:EventTrigger>
            </b:Interaction.Triggers>

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Background="Transparent">
                        <TextBlock Text="{Binding Name}"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>
